package com.whli.jee.system.controller;

import com.whli.jee.common.web.controller.BaseController;
import com.whli.jee.common.web.service.IBaseService;
import com.whli.jee.system.entity.SysSequence;
import com.whli.jee.system.service.ISysSequenceService;
import com.whli.jee.system.vo.SysSequenceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * <em>类或方法作用描述</em>
 * @author whli
 * @version 2018/9/4 9:26
 * */
@RestController
@RequestMapping(value="/system/sysSequence")
@Api(description = "序列规则API")
public class SysSequenceController extends BaseController<SysSequence, SysSequenceVO> {

	@Autowired
	private ISysSequenceService sysSequenceService;
	
	@Override
    public IBaseService<SysSequence> getService() {
        return sysSequenceService;
    }

    @PostMapping(value = "/validByNo")
    @ApiOperation("验证NO是否唯一性")
    public boolean validByNo(SysSequence entity){
	    SysSequence temp = sysSequenceService.validByNo(entity.getNo(),entity.getId());
	    if (temp != null){
	        return false;
        }
	    return true;
    }
}

